package io.gitee.welson.sensitive.model;

import io.gitee.welson.sensitive.enums.OverflowStrategy;

/**
 * Excel导出参数
 *
 * @author welson
 */
public class ExportParams {

    /**
     * 文件名（不含后缀）
     */
    private String fileName;

    /**
     * 文件后缀（默认.xlsx）
     */
    private String suffix;

    /**
     * Sheet页名称（多Sheet页导出时无效）
     */
    private String sheetName;

    /**
     * 编码格式（默认UTF-8）
     */
    private String encoding;

    /**
     * 单Sheet页最大行数，不指定时使用全局配置
     */
    private Integer sheetMaxRows;

    /**
     * 溢出策略（不指定时使用全局配置）
     * 注意：多sheet页导出时不支持分页策略，如果设置了分页策略会被忽略，使用截断策略代替
     */
    private OverflowStrategy overflowStrategy;

    private ExportParams() {}

    public static Builder builder() {
        return new Builder();
    }

    public String getFileName() {
        return fileName;
    }

    public String getSuffix() {
        return suffix;
    }

    public String getSheetName() {
        return sheetName;
    }

    public String getEncoding() {
        return encoding;
    }

    public Integer getSheetMaxRows() {
        return sheetMaxRows;
    }

    public OverflowStrategy getOverflowStrategy() {
        return overflowStrategy;
    }

    public static class Builder {
        private final ExportParams params;

        private Builder() {
            params = new ExportParams();
        }

        public Builder fileName(String fileName) {
            params.fileName = fileName;
            return this;
        }

        public Builder suffix(String suffix) {
            params.suffix = suffix;
            return this;
        }

        public Builder sheetName(String sheetName) {
            params.sheetName = sheetName;
            return this;
        }

        public Builder encoding(String encoding) {
            params.encoding = encoding;
            return this;
        }

        public Builder sheetMaxRows(Integer sheetMaxRows) {
            params.sheetMaxRows = sheetMaxRows;
            return this;
        }

        public Builder overflowStrategy(OverflowStrategy overflowStrategy) {
            params.overflowStrategy = overflowStrategy;
            return this;
        }

        public ExportParams build() {
            return params;
        }
    }
} 